package com.zbf.img.web;

import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashSet;

/**
 * 作者: LCG
 * 日期: 2019/8/13 16:36
 * 描述:
 */
@RestController
public class TestController {

    @Autowired
    private FastFileStorageClient fastFileStorageClient;

    @RequestMapping("uploadImage")
    public void uploadImage() throws FileNotFoundException {

       File file=new File("D:\\军工图片\\飞机\\美国飞机\\F-16\\美国F16-01.jpg");
       // File file=new File("");
        FileInputStream fileInputStream=new FileInputStream(file);
        StorePath path = fastFileStorageClient.uploadFile(fileInputStream,file.length(),FilenameUtils.getExtension(file.getName()),null);

        System.out.println(path.getFullPath());
    }

}
